<template>
  <div class="like-page">
    <van-nav-bar title="我的点赞" />
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="宝贝，没有更多了哦~~~"
      @load="onLoad"
    >
      <article-item v-for="item in list" :key="item.id" :item="item" />
    </van-list>
  </div>
</template>

<script>
import ArticleItem from '@/components/ArticleItem.vue'
import { getMyLike } from '@/api/article'
export default {
  name: 'collect-page',
  components: { ArticleItem },
  data () {
    return {
      list: [],
      loading: false,
      finished: false,
      current: 1
    }
  },
  methods: {
    async onLoad () {
      const { data } = await getMyLike()
      console.log(data)
      this.list.push(...data.rows)
      this.current++

      if (this.current > data.pageTotal) {
        this.finished = true
      }
    }
  }
}
</script>

<style lang="less" scoped>
.like-page {
  margin-bottom: 50px;
  // margin-top: 44px;
}
</style>
